home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Burning & Media
/
GB-PVR 1.2.13
/
GBPVR10213.msi
/
Cabs.w1.cab
/
scrolling.js457
< prev
next >
Wrap
Text File
|
2007-12-15
|
3KB
|
107 lines
//
//NON-CSS page scrolling functions
//
// Implements saving the current scroll position during a postback
// fixScrolling should be called on body.onload with the name
// of a hidden input field that has runat server enabled.
var __hiddenState;
function fixScrolling(hiddenId)
{
__hiddenState = document.getElementById(hiddenId);
document.body.scrollTop = __hiddenState.value;
window.onscroll = __scrolling_window_onscroll;
}
function __scrolling_window_onscroll()
{
__hiddenState.value = document.body.scrollTop;
}
//
//CSS page scrolling functions
//
// function save scroll position for CSS pages
function fScroll(val)
{
var hidScroll = document.getElementById('hdnScrollState');
hidScroll.value = val.scrollTop;
}
// function moves scroll position to saved value for CSS pages
function fScrollMove(what)
{
var hidScroll = document.getElementById('hdnScrollState');
document.getElementById(what).scrollTop = hidScroll.value;
}
// function captures url for cancel request and appends the current scroll position
function goCancel(canURL)
{
var hidScroll = document.getElementById('hdnScrollState')
var URL = canURL + '&scroll=' + hidScroll.value
window.location = URL
}
// function pulls scroll query string param and sets the page scroll to that position
function setScroll()
{
var qs = new Querystring()
var v1 = qs.get("scroll", "0")
var hidScroll = document.getElementById('hdnScrollState')
hidScroll.value = v1
}
// Set of functions from Internet that creates an java script object of the query string and allows retrieval of individual params
/* Client-side access to querystring name=value pairs
Version 1.2.3
22 Jun 2005
Adam Vandenberg
*/
function Querystring(qs) { // optionally pass a querystring to parse
this.params = new Object()
this.get=Querystring_get
if (qs == null)
qs=location.search.substring(1,location.search.length)
if (qs.length == 0) return
// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
qs = qs.replace(/\+/g, ' ')
var args = qs.split('&') // parse out name/value pairs separated via &
// split out each name=value pair
for (var i=0;i<args.length;i++) {
var value;
var pair = args[i].split('=')
var name = unescape(pair[0])
if (pair.length == 2)
value = unescape(pair[1])
else
value = name
this.params[name] = value
}
}
function Querystring_get(key, default_) {
// This silly looking line changes UNDEFINED to NULL
if (default_ == null) default_ = null;
var value=this.params[key]
if (value==null) value=default_;
return value
}